package com.lori.netshop.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lori.netshop.service.ItemService;
import com.lori.netshop.util.NetshopResult;

@Controller
@RequestMapping("/item")
public class ItemController {
	@Autowired
	private ItemService itemServiceimp;
	
	/**
	 * 接收商品id，返回NetshopResult带有商品信息
	 * @param id
	 * @return
	 */
	@RequestMapping("/base/{id}")
	@ResponseBody
	public NetshopResult items(@PathVariable("id")long id){
		return itemServiceimp.findItem(id);
	}
	/**
	 * 接收商品ID，返回NetshopResult带有商品详细信息
	 */
	@RequestMapping("/desc/{id}")
	@ResponseBody
	public NetshopResult itemDesc(@PathVariable("id")long id){
		return itemServiceimp.findItemDesc(id);
	}
	/**
	 * 接收商品ID，返回NetshopResult带有商品参数信息
	 */
	@RequestMapping("/param/{id}")
	@ResponseBody
	public NetshopResult itemParam(@PathVariable("id")long id){
		return itemServiceimp.findItemParam(id);
	}
	
}
